***************************************************************************
* Lyme Vaccine
***************************************************************************
clear
cd "WHERE YOU KEEP THE DATA"
use "sp123456_master"
cd "WHERE YOU WANT THE DATA TO GO"

** DATA MGMT

	* COVID Vaccination Intentions

	gen covidvaxabstain=covidvaxintention
		recode covidvaxabstain (1 2 = 0) (3 4 = 1) // Binary
		replace covidvaxabstain=0 if covidvaxreceipt==1 // Acct. for Already Vaxxed
		label variable covidvaxabstain "Intends to Abstain, COVID Vax."
		label values covidvaxabstain yn
		fre covidvaxabstain
		
	* Media Indicators 
	
	recode tv* news* (4 = 1) (3=.17) (2=.07) (1=0) // Scale by frequency
		
	* Anti-Exp
	
	gen antiexp=abs(expert1-7)/6
		label values antiexp hl
		label variable antiexp "Negative Att. Toward Experts"
		fre antiexp
		
	* General Vaccine Attitudes
	
	gen vaxsafety=abs(vaxautism-4)/3
		fre vaxsafety
		
	* COVID Vaccine Attitudes
	
	gen covidsafety=(covidvaxsafety-1)/3
		fre covidsafety
		
	* COVID Concern
	
	replace covidconcernus=(covidconcernus-1)/3
		
	* PID Dummies
	
	gen dem=0
		replace dem=1 if pid_lucid>=1 & pid_lucid<=3
		label values dem yn
		label variable dem "Democrat"
		fre dem
		
	gen gop=0
		replace gop=1 if pid_lucid>=5 & pid_lucid<=7
		label values gop yn
		label variable gop "Republican"
		fre gop
		
	* Demos
	
	gen inc=(hhi-1)/23
		label variable inc "Income"
		label values inc hl
		fre inc
	
	gen conservatism=(ideo-1)/6
		label values conservatism hl
		label variable conservatism "Conservatism"
		fre conservatism
		
	gen college=0
		replace college=1 if educ_lucid==4 | educ_lucid==5
		label values college yn
		label variable college "College Educated"
		fre college
	
	gen pid3a=.
		replace pid3a=0 if pid_lucid==4
		replace pid3a=1 if pid_lucid<4 & pid_lucid>0
		replace pid3a=2 if pid_lucid>4 & pid_lucid!=.
		fre pid3a

** Lyme Vaccine Spillover

alpha covidcollact*, item gen(covidcollact)
recode lymevax (3 4 =1) (1 2 =0)

reg lymevax vaxsafety covidvaxabstain covidconcernus ///
	conservatism i.pid3a antiexp college inc blacknh hispanic female [pw=weight] // STD Model
	
		est store m1
		
logit lymevax vaxsafety covidvaxabstain covidconcernus ///
	conservatism i.pid3a antiexp college inc blacknh hispanic female [pw=weight] // STD Model
	
		est store m4
		
** Moderated Spillover Effects

reg lymevax vaxsafety covidvaxabstain##i.pid3a covidconcernus ///
	conservatism antiexp college inc blacknh hispanic female [pw=weight] // STD Model
	
	est store mod1

reg lymevax vaxsafety covidvaxabstain c.covidconcernus##i.pid3a ///
	conservatism antiexp college inc blacknh hispanic female [pw=weight] // STD Model
	
	est store mod1a
	
***************************************************************************
* Cancer Vaccine
***************************************************************************
clear
cd "WHERE YOU KEEP THE DATA"
use "sp7.dta"
cd "WHERE YOU WANT THE DATA TO GO"

** DATA MGMT

	* COVID Vaccination Intentions

	gen covidvaxabstain=covidvaxreceipt
		recode covidvaxabstain (2 = 1) (1 = 0) // Binary
		label variable covidvaxabstain "Intends to Abstain, COVID Vax."
		label values covidvaxabstain yn
		fre covidvaxabstain

		
	* Media Indicators 
	
	recode tv* news* (4 = 1) (3=.17) (2=.07) (1=0) // Scale by frequency
		
	* Anti-Exp
	
	gen antiexp=abs(expert1-7)/6
		label values antiexp hl
		label variable antiexp "Negative Att. Toward Experts"
		fre antiexp
		
	* General Vaccine Attitudes
	
	gen vaxsafety=abs(vaxautism-4)/3
		fre vaxsafety
		
	* COVID Concern
	
	replace covidconcern=(covidconcern-1)/3
		
	* PID Dummies
	
	gen dem=0
		replace dem=1 if pid_lucid>=1 & pid_lucid<=3
		label values dem yn
		label variable dem "Democrat"
		fre dem
		
	gen gop=0
		replace gop=1 if pid_lucid>=5 & pid_lucid<=7
		label values gop yn
		label variable gop "Republican"
		fre gop
		
	* Demos
	
	gen inc=(hhi-1)/23
		label variable inc "Income"
		label values inc hl
		fre inc
	
	gen conservatism=(ideo-1)/6
		label values conservatism hl
		label variable conservatism "Conservatism"
		fre conservatism
		
	gen college=0
		replace college=1 if educ_lucid==4 | educ_lucid==5
		label values college yn
		label variable college "College Educated"
		fre college
		
	gen pid3a=.
		replace pid3a=0 if pid_lucid==4
		replace pid3a=1 if pid_lucid<4 & pid_lucid>0
		replace pid3a=2 if pid_lucid>4 & pid_lucid!=.
		fre pid3a
		
** Cancer Vaccine Spillover

recode cancerself (4 5 6 = 1) (1 2 3 =0) 
encode cancerexp, gen(cancerexp_n)

reg cancerself vaxsafety covidvaxabstain covidconcern ///
	conservatism i.pid3a antiexp college inc blacknh hispanic female i.cancerexp_n [pw=weight]
	
		est store m2
		
logit cancerself vaxsafety covidvaxabstain covidconcern ///
	conservatism i.pid3a antiexp college inc blacknh hispanic female i.cancerexp_n [pw=weight]
	
		est store m5
		
** Moderated Spillover Effects

reg cancerself vaxsafety covidvaxabstain##i.pid3a covidconcernus ///
	conservatism i.pid3a antiexp college inc blacknh hispanic female i.cancerexp_n [pw=weight] // STD Model
	
	est store mod2
	
	margins, at(pid3a=(0(1)2) covidvaxabstain=0 covidvaxabstain=1)
	marginsplot, ///
		scheme(s1mono) ///
		xlab(0 "Ind." 1 "Dem." 2 "GOP") ///
		plot1opts(lcolor(black) lpattern(solid) mcolor(none) mlcolor(black) msymb(circle)) ///
		plot2opts(lcolor(black) lpattern(dash) mcolor(black) mlcolor(black) msymb(circle)) ///
		ci1opts(lcolor(black%75)) ///
		ci2opts(lcolor(black%75)) ///
		legend(order(3 "Vaxxed" 4 "Unvaxxed") ///
			pos(1) ring(0) size(vsmall) region(fcolor(none) lcolor(none)) col(1) ) ///
		aspect(1) ///
		title(" " ) ///
		xtitle(" " "PID") ///
		ytitle("Pr(Refuse Cancer Vax.)" " ") 
		
		graph export "mod2.pdf", replace
		
reg cancerself vaxsafety covidvaxabstain c.covidconcernus##i.pid3a  ///
	conservatism i.pid3a antiexp college inc blacknh hispanic female i.cancerexp_n [pw=weight] // STD Model
	
	est store mod2a


***************************************************************************
* Results: Tabular 
***************************************************************************

log using "replicationresults.txt", replace

	estout m1 m2, ///
	cells(b (star fmt(2)  vacant("-")) p(par(( )))) ///
         starlevels(+ 0.10 * 0.05) stats(N r2, fmt(0 2)) ///
		 drop(1.cancerexp_n 0.pid3a) ///
		 varlabels( ///
		 _cons "$\beta_0$" ///
		 vaxsafety "Thinks MMR is Unsafe" ///
		 covidvaxabstain "Refused COVID-19 Vax." ///
		 covidconcernus "Low Concern about COVID Health fx" ///
		 conservatism "Ideology (1 = Ext. Conserv.)" ///
		 antiexp "Anti-Expert Attitudes" ///
		 college "College Educ." ///
		 inc "Household Income" ///
		 female "Gender ID = Female" ///
		 blacknh  "Racial ID = Black" ///
		 hispanic  "Racial ID = Hispanic" ///
		 1.pid3a "PID = Dem" ///
		 2.pid3a "PID = GOP" ///
		 2.cancerexp_n "Cancer Exp: Democrat Frame" ///
		 3.cancerexp_n "Cancer Exp: GOP Frame" ///
		 ) ///
		order(covidvaxabstain) style(tex)
		
	estout m4 m5, ///
	cells(b (star fmt(2)  vacant("-")) se(par(( )))) ///
         starlevels(+ 0.10 * 0.05) stats(N r2, fmt(0 2)) ///
		 drop(1.cancerexp_n 0.pid3a) ///
		 varlabels( ///
		 _cons "$\beta_0$" ///
		 vaxsafety "Thinks MMR is Unsafe" ///
		 covidvaxabstain "Refused COVID-19 Vax." ///
		 covidconcernus "Low Concern about COVID Health fx" ///
		 conservatism "Ideology (1 = Ext. Conserv.)" ///
		 antiexp "Anti-Expert Attitudes" ///
		 college "College Educ." ///
		 inc "Household Income" ///
		 female "Gender ID = Female" ///
		 blacknh  "Racial ID = Black" ///
		 hispanic  "Racial ID = Hispanic" ///
		 1.pid3a "PID = Dem" ///
		 2.pid3a "PID = GOP" ///
		 2.cancerexp_n "Cancer Exp: Democrat Frame" ///
		 3.cancerexp_n "Cancer Exp: GOP Frame" ///
		 ) ///
		order(covidvaxabstain)  style(tex)
		
	estout mod1a mod2a, ///
	cells(b (star fmt(2)  vacant("-")) se(par(( )))) ///
         starlevels(+ 0.10 * 0.05) stats(N r2, fmt(0 2)) ///
		 drop(*0.* 0.pid3a 1.cancerexp_n) ///
		 varlabels( ///
		 _cons "$\beta_0$" ///
		 vaxsafety "Thinks MMR is Unsafe" ///
		 1.pid3a#c.covidconcernus "Concern X Dem" ///
		 2.pid3a#c.covidconcernus "Concern X GOP" ///
		 covidvaxabstain "Refused COVID-19 Vax." ///
		 1.covidvaxabstain "Refused COVID-19 Vax." ///
		 covidconcernus "Low Concern about COVID Health fx" ///
		 conservatism "Ideology (1 = Ext. Conserv.)" ///
		 antiexp "Anti-Expert Attitudes" ///
		 college "College Educ." ///
		 inc "Household Income" ///
		 female "Gender ID = Female" ///
		 blacknh  "Racial ID = Black" ///
		 hispanic  "Racial ID = Hispanic" ///
		 1.pid3a "PID = Dem" ///
		 2.pid3a "PID = GOP" ///
		 2.cancerexp_n "Cancer Exp: Democrat Frame" ///
		 3.cancerexp_n "Cancer Exp: GOP Frame" ///
		 ) ///
		order(covidvaxabstain)  style(tex)
		
	estout mod1 mod2, ///
	cells(b (star fmt(2)  vacant("-")) se(par(( )))) ///
         starlevels(+ 0.10 * 0.05) stats(N r2, fmt(0 2)) ///
		 drop(*0.* 0.pid3a 1.cancerexp_n) ///
		 varlabels( ///
		 _cons "$\beta_0$" ///
		 vaxsafety "Thinks MMR is Unsafe" ///
		 1.covidvaxabstain#1.pid3a "Refuse COVID X Dem" ///
		 1.covidvaxabstain#2.pid3a "Refuse COVID X GOP" ///
		 covidvaxabstain "Refused COVID-19 Vax." ///
		 1.covidvaxabstain "Refused COVID-19 Vax." ///
		 covidconcernus "Low Concern about COVID Health fx" ///
		 conservatism "Ideology (1 = Ext. Conserv.)" ///
		 antiexp "Anti-Expert Attitudes" ///
		 college "College Educ." ///
		 inc "Household Income" ///
		 female "Gender ID = Female" ///
		 blacknh  "Racial ID = Black" ///
		 hispanic  "Racial ID = Hispanic" ///
		 1.pid3a "PID = Dem" ///
		 2.pid3a "PID = GOP" ///
		 2.cancerexp_n "Cancer Exp: Democrat Frame" ///
		 3.cancerexp_n "Cancer Exp: GOP Frame" ///
		 ) ///
		order(covidvaxabstain)  style(tex)
		
	
log close

***************************************************************************
* Results: Graphical 
***************************************************************************

	coefplot ///
			(m1, msymb(circle) mcolor(blue%25) mlcolor(blue%50) ciopts(lcolor(blue%25))) ///
			m2, ///
			sort(, descending) ///
			drop(*cancerexp_n 2.wave 3.wave _cons) ///
			scheme(s1mono) xline(0, lpattern(dash) lcolor(red%50)) ///
			ciopts(lcolor(green%25)) ///
			msymb(circle) mlcolor(green%50) mcolor(green%25) ///
			lcolor(black) lpattern(dash) ///
			rename( ///
				vaxsafety = "Thinks MMR is Unsafe" ///
				covidvaxabstain = "Refused COVID-19 Vax." ///
				covidconcernus = "Low Concern about COVID Health fx" ///
				conservatism = "Ideology (1 = Ext. Conserv.)" ///
				antiexp = "Anti-Expert Attitudes" ///
				college = "College Educ." ///
				inc = "Household Income" ///
				female = "Gender ID = Female" ///
				blacknh = "Racial ID = Black" ///
				hispanic = "Racial ID = Hispanic" ///
				1.pid3a = "PID = Dem" ///
				2.pid3a = "PID = GOP" ///
				2.cancerexp_n = "Cancer Exp: Democrat Frame" ///
				3.cancerexp_n = "Cancer Exp: GOP Frame" ///
			) ///
			ylab(, labsize(small)) ///
			title(" " " ") ///
			ytitle(" ") ///
			xtitle(" " "Effect on Plans to Vaccinate") ///
			xlab(-1 "More Likely" 0 1 "Less Likely", labsize(small)) ///
			legend(order(2 "Lyme Vax." 4 "Cancer Vax.") ///
				size(small) col(1) pos(3) region(lcolor(none) fcolor(none)))
